package com.xuexiang.xuidemo.slice;

import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;
import ohos.agp.components.Image;
import ohos.agp.components.Text;

import com.xuexiang.xuidemo.ResourceTable;

/**
 * 流标签
 */
public class NormalFlowLayoutAbilitySlice extends AbilitySlice  implements Component.ClickedListener {
    private Text text_title,text_title_bottom;
    private Image image_back;
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_normal_flowlayout);
        initComponent();
        initTitle();
        inintClickedListener();
    }
    private void initComponent() {
        image_back=(Image) findComponentById(ResourceTable.Id_image_back);
        text_title=(Text)findComponentById(ResourceTable.Id_text_title);
        text_title_bottom=(Text)findComponentById(ResourceTable.Id_text_title_bottom);
    }
    private void inintClickedListener() {
        image_back.setClickedListener(this);
    }

    private void initTitle() {
        text_title.setText("FlowLayout");
        text_title_bottom.setText("流布局");
    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }

    @Override
    public void onClick(Component component) {
        switch (component.getId()){
            case ResourceTable.Id_image_back:
                onBackPressed();
                break;
        }
    }
}
